﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using CommonLibrary.Classes.ImageCapture;
using System.Drawing.Imaging;
namespace FeatureTesting
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private ScreenCapture _screenCapture;

        private void buttonCapture_Click(object sender, EventArgs e)
        {
            bool valid; 
            
            if (captureScreenSaveDialog.ShowDialog() == DialogResult.OK)
            {
                this.Hide();
                Thread.Sleep(500);
                _screenCapture = new ScreenCapture(ImageFormat.Png);
                _screenCapture.CaptureImage(Screen.PrimaryScreen);

                valid = _screenCapture.SaveImage(captureScreenSaveDialog.FileName);

                if (valid)
                {
                    MessageBox.Show("Saved Screen Shot successfully");
                }

                this.Show();

            }
        }
    }
}
